package com.iraeta.controller.report;

import com.iraeta.common.AuthAccess;
import com.iraeta.controller.BaseController;
import com.iraeta.entity.oa.RenYuanDangAn;
import com.iraeta.service.oa.RenYuanDangAnServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController(value = "TestController")
@RequestMapping("test")
public class TestController extends BaseController {
    @Autowired
    RenYuanDangAnServiceImpl renYuanDangAnService;

    @RequestMapping("listdangan")
    @AuthAccess
    public String listDangAn(){
        List<RenYuanDangAn> renYuanDangAns = renYuanDangAnService.listAllRenYuanDangAn();
        List<String> nameList = renYuanDangAns.stream().map(RenYuanDangAn::getField0002).collect(Collectors.toList());
        return nameList.toString();
    }
}
